package cn.net.shuxing.yifu.common.service;

import cn.net.shuxing.yifu.common.bean.DealParamKey;
import cn.net.shuxing.yifu.common.mapper.DealParamKeyMapper;
import cn.net.shuxing.yifu.common.util.CommonExample;
import org.springframework.stereotype.Service;

@Service
public class DealParamKeyService extends BaseService<DealParamKey,DealParamKeyMapper> {

    public int insert(String dealParamName) {
        DealParamKey dealParamKey = new DealParamKey();
        dealParamKey.setDealParamName(dealParamName);
        return super.insert(dealParamKey);
    }

    public Integer getKeyByParamName(String name)
    {
        CommonExample example = new CommonExample(DealParamKey.class);
        example.equals("dealParamName", name);
        return mapper.selectOneByExample(example).getId();
    }

    public DealParamKey getByParamName(String name)
    {
        CommonExample example = new CommonExample(DealParamKey.class);
        example.equals("dealParamName", name);
        DealParamKey dealParamKey = mapper.selectOneByExample(example);
        complete(dealParamKey);
        return dealParamKey;
    }
}
